﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Avatar.Model;
using AvatarHelper;
using System.Linq;
using System.Data.Linq;

public partial class About : System.Web.UI.Page
{
    public string _title, _content;

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            try
            {
                using (var _adc = DBHelper.GetDataContext())
                {
                    var _config = _adc.SiteConfig.FirstOrDefault();
                    if (_config != null)
                    {
                        int _action;
                        try
                        {
                            _action = Request.QueryString["Action"] == null ? 1 : Convert.ToInt32(Request.QueryString["Action"].ToString());
                        }
                        catch
                        {
                            _action = 1;
                        }
                        switch (_action)
                        {
                            case 1:
                                lbl_Title.Text = "关于我们";
                                lbl_Content.Text = _config.About;
                                break;
                            case 2:
                                lbl_Title.Text = "网站声明";
                                lbl_Content.Text = _config.Statement;
                                break;
                            case 3:
                                lbl_Title.Text = "收费标准";
                                lbl_Content.Text = _config.Charges;
                                break;
                            case 4:
                                lbl_Title.Text = "服务中心";
                                lbl_Content.Text = _config.ServiceCenter;
                                break;
                            case 5:
                                lbl_Title.Text = "联系我们";
                                lbl_Content.Text = _config.ContactUs;
                                break;
                            default:
                                lbl_Title.Text = "关于我们";
                                lbl_Content.Text = _config.About;
                                break;
                        }
                    }
                }
            }
            catch(Exception _e)
            {
                lbl_Error.Text = "错误:" + _e.Message;
            }
        }
    }
}
